//
//  UIButton+SDExtension.m
//  Copy_生鲜
//
//  Created by SD on 2017/3/16.
//  Copyright © 2017年 SD. All rights reserved.
//

#import "UIButton+SDExtension.h"

@implementation UIButton (SDExtension)
static char overviewKey;

- (void)addTargetHandler:(Handler)handler{
    
    objc_setAssociatedObject(self, &overviewKey, handler, OBJC_ASSOCIATION_COPY_NONATOMIC);
    [self addTarget:self action:@selector(Action:) forControlEvents:UIControlEventTouchUpInside];
}
- (void)Action:(UIButton *)button{
    
    Handler handler = objc_getAssociatedObject(self, &overviewKey);
    
    !handler?:handler();
}
@end
